package com.example.ivideo_2211a.commodity.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

@Dao
interface FavoriteGoodsDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(goods: FavoriteGoods)

    @Delete
    suspend fun delete(goods: FavoriteGoods)

    @Query("SELECT * FROM favorite_goods WHERE goodsId = :goodsId LIMIT 1")
    suspend fun getFavorite(goodsId: Int): FavoriteGoods?
}
